#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, k;
int a[N], b[N];

int main() {
	cin >> n >> m >> k;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
	}
	for (int i = 0, j = m - 1; i < n; ++i) {
		while (j >= 0 && a[i] + b[j] > k) {
			--j;
		}
		if (a[i] + b[j] == k) {
			cout << i << ' ' << j << endl;
		}
	}
	return 0;
}